﻿using _11._24._2014_AngularPractice.Adapters;
using _11._24._2014_AngularPractice.Adapters.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Microsoft.AspNet.Identity;

namespace _11._24._2014_AngularPractice.Controllers
{
    [Authorize]
    public class CarController : ApiController
    {
        private ICarAdapter _adapter;

        public CarController()
        {
            _adapter = new CarDataAdapter();
        }
        public IHttpActionResult Get()
        {
            var userId = User.Identity.GetUserId();

            var model = _adapter.GetCarViewModels(userId);

            return Ok(model);
        }
    }
}
